﻿using Furion.CMS.Core.Base;
using Furion.DatabaseAccessor;
using Microsoft.AspNetCore.Mvc;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace Furion.CMS.Core
{
    /// <summary>
    /// Curd应用服务
    /// </summary>
    /// <typeparam name="TEntity">数据表映射实体</typeparam>
    /// <typeparam name="TKey">数据表主键类型</typeparam>
    /// <typeparam name="TCreateDto">创建数据传输对象</typeparam>
    /// <typeparam name="TUpdateDto">更新数据参数对象</typeparam>
    /// <typeparam name="TListDto">列表数据传输对象</typeparam>
    /// <typeparam name="TDetailDto">详情数据传输对象</typeparam>
    /// <typeparam name="TFilterParams">数据过滤参数</typeparam>
    /// <typeparam name="TSortParams">排序参数</typeparam>
    public interface ICurdAppService<TEntity, TKey, TCreateDto, TUpdateDto, TListDto, TDetailDto, TFilterParams, TSortParams> : IReadOnlyAppService<TEntity, TListDto, TDetailDto, TFilterParams, TSortParams>
        where TEntity : class, IPrivateEntity, new()
        where TCreateDto : class, new()
        where TUpdateDto : class, new()
        where TListDto : class, new()
        where TDetailDto : class, new()
        where TFilterParams : BaseFilterParams<TEntity>, new()
        where TSortParams : BaseSortParams, new()
    {
        /// <summary>
        /// 创建
        /// </summary>
        /// <param name="dto"></param>
        void Create(TCreateDto dto);
        /// <summary>
        /// 更新
        /// </summary>
        /// <param name="id"></param>
        /// <param name="dto"></param>
        void Update(TKey id, [FromBody] TUpdateDto dto);
        /// <summary>
        /// 删除一个或多个
        /// </summary>
        /// <param name="ids"></param>
        void Delete([FromBody] IList<TKey> ids);
    }
}
